<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Rancher的高可用部署 | 十三不知</title><meta name="keywords" content="Kubernetes,DevOps"><meta name="author" content="张十三"><meta name="copyright" content="张十三"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="Rancher的高可用部署 这里我使用的mac的Docker Desktop安装的kubeternetes集群，是默认没有ingress controller的，所以需要先安装ingress-controller mac安装ingress-controller 1kubectl apply -f https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;ku">
<meta property="og:type" content="article">
<meta property="og:title" content="Rancher的高可用部署">
<meta property="og:url" content="http://zuori.gitee.io/zaker/2021/02/25/Rancher%E7%9A%84%E9%AB%98%E5%8F%AF%E7%94%A8%E5%AE%89%E8%A3%85/index.html">
<meta property="og:site_name" content="十三不知">
<meta property="og:description" content="Rancher的高可用部署 这里我使用的mac的Docker Desktop安装的kubeternetes集群，是默认没有ingress controller的，所以需要先安装ingress-controller mac安装ingress-controller 1kubectl apply -f https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;ku">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg">
<meta property="article:published_time" content="2021-02-25T11:46:36.000Z">
<meta property="article:modified_time" content="2021-03-26T08:09:29.172Z">
<meta property="article:author" content="张十三">
<meta property="article:tag" content="Kubernetes">
<meta property="article:tag" content="DevOps">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg"><link rel="shortcut icon" href="https://gitee.com/zuori/kaiscript/raw/master/images/20210325203813.png"><link rel="canonical" href="http://zuori.gitee.io/zaker/2021/02/25/Rancher%E7%9A%84%E9%AB%98%E5%8F%AF%E7%94%A8%E5%AE%89%E8%A3%85/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/zaker/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/zaker/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: 张十三","link":"链接: ","source":"来源: 十三不知","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-03-26 16:09:29'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><meta name="generator" content="Hexo 5.4.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://gitee.com/zuori/kaiscript/raw/master/images/20210325192506.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/zaker/archives/"><div class="headline">文章</div><div class="length-num">13</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/zaker/tags/"><div class="headline">标签</div><div class="length-num">11</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/zaker/categories/"><div class="headline">分类</div><div class="length-num">4</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/zaker/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/zaker/">十三不知</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/zaker/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">Rancher的高可用部署</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-02-25T11:46:36.000Z" title="发表于 2021-02-25 19:46:36">2021-02-25</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-03-26T08:09:29.172Z" title="更新于 2021-03-26 16:09:29">2021-03-26</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/zaker/categories/%E4%BA%91%E5%8E%9F%E7%94%9F/">云原生</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="Rancher的高可用部署"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1>Rancher的高可用部署</h1>
<p>这里我使用的mac的Docker Desktop安装的kubeternetes集群，是默认没有ingress controller的，所以需要先安装ingress-controller<br>
mac安装ingress-controller</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">kubectl apply -f https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;kubernetes&#x2F;ingress-nginx&#x2F;controller-v0.43.0&#x2F;deploy&#x2F;static&#x2F;provider&#x2F;cloud&#x2F;deploy.yaml</span><br></pre></td></tr></table></figure>
<p>Rancher Server 默认需要 SSL/TLS 配置来保证访问的安全性</p>
<p>有三种关于证书来源的推荐选项，证书将用来在 Rancher Server 中终止 TLS：</p>
<ul>
<li>
<p><strong>Rancher 生成的自签名证书：</strong> 在这种情况下，您需要在集群中安装<code>cert-manager</code>。 Rancher 利用<code>cert-manager</code>签发并维护证书。Rancher 将生成自己的 CA 证书，并使用该 CA 签署证书。然后，<code>cert-manager</code>负责管理该证书。</p>
</li>
<li>
<p><strong>Let’s Encrypt：</strong> Let’s Encrypt 选项也需要使用<code>cert-manager</code>。但是，在这种情况下，<code>cert-manager</code>与特殊的 Issuer 结合使用，<code>cert-manager</code>将执行获取 Let’s Encrypt 发行的证书所需的所有操作（包括申请和验证）。此配置使用 HTTP 验证（<code>HTTP-01</code>），因此负载均衡器必须具有可以从公网访问的公共 DNS 记录。</p>
</li>
<li>
<p><strong>使用自己的证书：</strong> 此选项使您可以使用自己的权威 CA 颁发的证书或自签名 CA 证书。 Rancher 将使用该证书来保护 WebSocket 和 HTTPS 流量。在这种情况下，您必须上传名称分别为<code>tls.crt</code>和<code>tls.key</code>的 PEM 格式的证书以及相关的密钥。如果使用私有 CA，则还必须上传该证书。这是由于您的节点可能不信任此私有 CA。 Rancher 将获取该 CA 证书，并从中生成一个校验和，各种 Rancher 组件将使用该校验和来验证其与 Rancher 的连接</p>
<table>
<thead>
<tr>
<th>设置</th>
<th>Chart 选项</th>
<th>描述</th>
<th>是否需要 cert-manager</th>
</tr>
</thead>
<tbody>
<tr>
<td>Rancher 生成的自签名证书</td>
<td><code>ingress.tls.source=rancher</code></td>
<td>使用 Rancher 生成的 CA 签发的自签名证书 此项为<strong>默认选项</strong></td>
<td><a target="_blank" rel="noopener" href="https://docs.rancher.cn/docs/rancher2/installation_new/install-rancher-on-k8s/_index#%E5%8F%AF%E9%80%89%EF%BC%9A%E5%AE%89%E8%A3%85-cert-manager">是</a></td>
</tr>
<tr>
<td>Let’s Encrypt</td>
<td><code>ingress.tls.source=letsEncrypt</code></td>
<td>使用<a target="_blank" rel="noopener" href="https://letsencrypt.org/">Let’s Encrypt</a>颁发的证书</td>
<td><a target="_blank" rel="noopener" href="https://docs.rancher.cn/docs/rancher2/installation_new/install-rancher-on-k8s/_index#%E5%8F%AF%E9%80%89%EF%BC%9A%E5%AE%89%E8%A3%85-cert-manager">是</a></td>
</tr>
<tr>
<td>您已有的证书</td>
<td><code>ingress.tls.source=secret</code></td>
<td>使用您的自己的证书（Kubernetes 密文）</td>
<td>否</td>
</tr>
</tbody>
</table>
</li>
</ul>
<p>这里使用的是自签名证书</p>
<h2 id="生成自签名证书以及配置密钥">生成自签名证书以及配置密钥</h2>
<p><strong>1. 创建rancher的namespace</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">kubectl create namespace rancher</span><br></pre></td></tr></table></figure>
<p><strong>2. 生成自签名证书</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">!/bin/bash -e</span></span><br><span class="line"></span><br><span class="line">help ()</span><br><span class="line">&#123;</span><br><span class="line">    echo  &#x27; ================================================================ &#x27;</span><br><span class="line">    echo  &#x27; --ssl-domain: 生成ssl证书需要的主域名，如不指定则默认为www.rancher.local，如果是ip访问服务，则可忽略；&#x27;</span><br><span class="line">    echo  &#x27; --ssl-trusted-ip: 一般ssl证书只信任域名的访问请求，有时候需要使用ip去访问server，那么需要给ssl证书添加扩展IP，多个IP用逗号隔开；&#x27;</span><br><span class="line">    echo  &#x27; --ssl-trusted-domain: 如果想多个域名访问，则添加扩展域名（SSL_TRUSTED_DOMAIN）,多个扩展域名用逗号隔开；&#x27;</span><br><span class="line">    echo  &#x27; --ssl-size: ssl加密位数，默认2048；&#x27;</span><br><span class="line">    echo  &#x27; --ssl-cn: 国家代码(2个字母的代号),默认CN;&#x27;</span><br><span class="line">    echo  &#x27; 使用示例:&#x27;</span><br><span class="line">    echo  &#x27; ./create_self-signed-cert.sh --ssl-domain=www.test.com --ssl-trusted-domain=www.test2.com \ &#x27;</span><br><span class="line">    echo  &#x27; --ssl-trusted-ip=1.1.1.1,2.2.2.2,3.3.3.3 --ssl-size=2048 --ssl-date=3650&#x27;</span><br><span class="line">    echo  &#x27; ================================================================&#x27;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">case &quot;$1&quot; in</span><br><span class="line">    -h|--help) help; exit;;</span><br><span class="line">esac</span><br><span class="line"></span><br><span class="line">if [[ $1 == &#x27;&#x27; ]];then</span><br><span class="line">    help;</span><br><span class="line">    exit;</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">CMDOPTS=&quot;$*&quot;</span><br><span class="line">for OPTS in $CMDOPTS;</span><br><span class="line">do</span><br><span class="line">    key=$(echo $&#123;OPTS&#125; | awk -F&quot;=&quot; &#x27;&#123;print $1&#125;&#x27; )</span><br><span class="line">    value=$(echo $&#123;OPTS&#125; | awk -F&quot;=&quot; &#x27;&#123;print $2&#125;&#x27; )</span><br><span class="line">    case &quot;$key&quot; in</span><br><span class="line">        --ssl-domain) SSL_DOMAIN=$value ;;</span><br><span class="line">        --ssl-trusted-ip) SSL_TRUSTED_IP=$value ;;</span><br><span class="line">        --ssl-trusted-domain) SSL_TRUSTED_DOMAIN=$value ;;</span><br><span class="line">        --ssl-size) SSL_SIZE=$value ;;</span><br><span class="line">        --ssl-date) SSL_DATE=$value ;;</span><br><span class="line">        --ca-date) CA_DATE=$value ;;</span><br><span class="line">        --ssl-cn) CN=$value ;;</span><br><span class="line">    esac</span><br><span class="line">done</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> CA相关配置</span></span><br><span class="line">CA_DATE=$&#123;CA_DATE:-3650&#125;</span><br><span class="line">CA_KEY=$&#123;CA_KEY:-cakey.pem&#125;</span><br><span class="line">CA_CERT=$&#123;CA_CERT:-cacerts.pem&#125;</span><br><span class="line">CA_DOMAIN=cattle-ca</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> ssl相关配置</span></span><br><span class="line">SSL_CONFIG=$&#123;SSL_CONFIG:-$PWD/openssl.cnf&#125;</span><br><span class="line">SSL_DOMAIN=$&#123;SSL_DOMAIN:-&#x27;www.rancher.local&#x27;&#125;</span><br><span class="line">SSL_DATE=$&#123;SSL_DATE:-3650&#125;</span><br><span class="line">SSL_SIZE=$&#123;SSL_SIZE:-2048&#125;</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="comment"># 国家代码(2个字母的代号),默认CN;</span></span></span><br><span class="line">CN=$&#123;CN:-CN&#125;</span><br><span class="line"></span><br><span class="line">SSL_KEY=$SSL_DOMAIN.key</span><br><span class="line">SSL_CSR=$SSL_DOMAIN.csr</span><br><span class="line">SSL_CERT=$SSL_DOMAIN.crt</span><br><span class="line"></span><br><span class="line">echo -e &quot;\033[32m ---------------------------- \033[0m&quot;</span><br><span class="line">echo -e &quot;\033[32m       | 生成 SSL Cert |       \033[0m&quot;</span><br><span class="line">echo -e &quot;\033[32m ---------------------------- \033[0m&quot;</span><br><span class="line"></span><br><span class="line">if [[ -e ./$&#123;CA_KEY&#125; ]]; then</span><br><span class="line">    echo -e &quot;\033[32m ====&gt; 1. 发现已存在CA私钥，备份&quot;$&#123;CA_KEY&#125;&quot;为&quot;$&#123;CA_KEY&#125;&quot;-bak，然后重新创建 \033[0m&quot;</span><br><span class="line">    mv $&#123;CA_KEY&#125; &quot;$&#123;CA_KEY&#125;&quot;-bak</span><br><span class="line">    openssl genrsa -out $&#123;CA_KEY&#125; $&#123;SSL_SIZE&#125;</span><br><span class="line">else</span><br><span class="line">    echo -e &quot;\033[32m ====&gt; 1. 生成新的CA私钥 $&#123;CA_KEY&#125; \033[0m&quot;</span><br><span class="line">    openssl genrsa -out $&#123;CA_KEY&#125; $&#123;SSL_SIZE&#125;</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">if [[ -e ./$&#123;CA_CERT&#125; ]]; then</span><br><span class="line">    echo -e &quot;\033[32m ====&gt; 2. 发现已存在CA证书，先备份&quot;$&#123;CA_CERT&#125;&quot;为&quot;$&#123;CA_CERT&#125;&quot;-bak，然后重新创建 \033[0m&quot;</span><br><span class="line">    mv $&#123;CA_CERT&#125; &quot;$&#123;CA_CERT&#125;&quot;-bak</span><br><span class="line">    openssl req -x509 -sha256 -new -nodes -key $&#123;CA_KEY&#125; -days $&#123;CA_DATE&#125; -out $&#123;CA_CERT&#125; -subj &quot;/C=$&#123;CN&#125;/CN=$&#123;CA_DOMAIN&#125;&quot;</span><br><span class="line">else</span><br><span class="line">    echo -e &quot;\033[32m ====&gt; 2. 生成新的CA证书 $&#123;CA_CERT&#125; \033[0m&quot;</span><br><span class="line">    openssl req -x509 -sha256 -new -nodes -key $&#123;CA_KEY&#125; -days $&#123;CA_DATE&#125; -out $&#123;CA_CERT&#125; -subj &quot;/C=$&#123;CN&#125;/CN=$&#123;CA_DOMAIN&#125;&quot;</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">echo -e &quot;\033[32m ====&gt; 3. 生成Openssl配置文件 $&#123;SSL_CONFIG&#125; \033[0m&quot;</span><br><span class="line">cat &gt; $&#123;SSL_CONFIG&#125; &lt;&lt;EOM</span><br><span class="line">[req]</span><br><span class="line">req_extensions = v3_req</span><br><span class="line">distinguished_name = req_distinguished_name</span><br><span class="line">[req_distinguished_name]</span><br><span class="line">[ v3_req ]</span><br><span class="line">basicConstraints = CA:FALSE</span><br><span class="line">keyUsage = nonRepudiation, digitalSignature, keyEncipherment</span><br><span class="line">extendedKeyUsage = clientAuth, serverAuth</span><br><span class="line">EOM</span><br><span class="line"></span><br><span class="line">if [[ -n $&#123;SSL_TRUSTED_IP&#125; || -n $&#123;SSL_TRUSTED_DOMAIN&#125; ]]; then</span><br><span class="line">    cat &gt;&gt; $&#123;SSL_CONFIG&#125; &lt;&lt;EOM</span><br><span class="line">subjectAltName = @alt_names</span><br><span class="line">[alt_names]</span><br><span class="line">EOM</span><br><span class="line">    IFS=&quot;,&quot;</span><br><span class="line">    dns=($&#123;SSL_TRUSTED_DOMAIN&#125;)</span><br><span class="line">    dns+=($&#123;SSL_DOMAIN&#125;)</span><br><span class="line">    for i in &quot;$&#123;!dns[@]&#125;&quot;; do</span><br><span class="line">      echo DNS.$((i+1)) = $&#123;dns[$i]&#125; &gt;&gt; $&#123;SSL_CONFIG&#125;</span><br><span class="line">    done</span><br><span class="line"></span><br><span class="line">    if [[ -n $&#123;SSL_TRUSTED_IP&#125; ]]; then</span><br><span class="line">        ip=($&#123;SSL_TRUSTED_IP&#125;)</span><br><span class="line">        for i in &quot;$&#123;!ip[@]&#125;&quot;; do</span><br><span class="line">          echo IP.$((i+1)) = $&#123;ip[$i]&#125; &gt;&gt; $&#123;SSL_CONFIG&#125;</span><br><span class="line">        done</span><br><span class="line">    fi</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">echo -e &quot;\033[32m ====&gt; 4. 生成服务SSL KEY $&#123;SSL_KEY&#125; \033[0m&quot;</span><br><span class="line">openssl genrsa -out $&#123;SSL_KEY&#125; $&#123;SSL_SIZE&#125;</span><br><span class="line"></span><br><span class="line">echo -e &quot;\033[32m ====&gt; 5. 生成服务SSL CSR $&#123;SSL_CSR&#125; \033[0m&quot;</span><br><span class="line">openssl req -sha256 -new -key $&#123;SSL_KEY&#125; -out $&#123;SSL_CSR&#125; -subj &quot;/C=$&#123;CN&#125;/CN=$&#123;SSL_DOMAIN&#125;&quot; -config $&#123;SSL_CONFIG&#125;</span><br><span class="line"></span><br><span class="line">echo -e &quot;\033[32m ====&gt; 6. 生成服务SSL CERT $&#123;SSL_CERT&#125; \033[0m&quot;</span><br><span class="line">openssl x509 -sha256 -req -in $&#123;SSL_CSR&#125; -CA $&#123;CA_CERT&#125; \</span><br><span class="line">    -CAkey $&#123;CA_KEY&#125; -CAcreateserial -out $&#123;SSL_CERT&#125; \</span><br><span class="line">    -days $&#123;SSL_DATE&#125; -extensions v3_req \</span><br><span class="line">    -extfile $&#123;SSL_CONFIG&#125;</span><br><span class="line"></span><br><span class="line">echo -e &quot;\033[32m ====&gt; 7. 证书制作完成 \033[0m&quot;</span><br><span class="line">echo</span><br><span class="line">echo -e &quot;\033[32m ====&gt; 8. 以YAML格式输出结果 \033[0m&quot;</span><br><span class="line">echo &quot;----------------------------------------------------------&quot;</span><br><span class="line">echo &quot;ca_key: |&quot;</span><br><span class="line">cat $CA_KEY | sed &#x27;s/^/  /&#x27;</span><br><span class="line">echo</span><br><span class="line">echo &quot;ca_cert: |&quot;</span><br><span class="line">cat $CA_CERT | sed &#x27;s/^/  /&#x27;</span><br><span class="line">echo</span><br><span class="line">echo &quot;ssl_key: |&quot;</span><br><span class="line">cat $SSL_KEY | sed &#x27;s/^/  /&#x27;</span><br><span class="line">echo</span><br><span class="line">echo &quot;ssl_csr: |&quot;</span><br><span class="line">cat $SSL_CSR | sed &#x27;s/^/  /&#x27;</span><br><span class="line">echo</span><br><span class="line">echo &quot;ssl_cert: |&quot;</span><br><span class="line">cat $SSL_CERT | sed &#x27;s/^/  /&#x27;</span><br><span class="line">echo</span><br><span class="line"></span><br><span class="line">echo -e &quot;\033[32m ====&gt; 9. 附加CA证书到Cert文件 \033[0m&quot;</span><br><span class="line">cat $&#123;CA_CERT&#125; &gt;&gt; $&#123;SSL_CERT&#125;</span><br><span class="line">echo &quot;ssl_cert: |&quot;</span><br><span class="line">cat $SSL_CERT | sed &#x27;s/^/  /&#x27;</span><br><span class="line">echo</span><br><span class="line"></span><br><span class="line">echo -e &quot;\033[32m ====&gt; 10. 重命名服务证书 \033[0m&quot;</span><br><span class="line">echo &quot;cp $&#123;SSL_DOMAIN&#125;.key tls.key&quot;</span><br><span class="line">cp $&#123;SSL_DOMAIN&#125;.key tls.key</span><br><span class="line">echo &quot;cp $&#123;SSL_DOMAIN&#125;.crt tls.crt&quot;</span><br><span class="line">cp $&#123;SSL_DOMAIN&#125;.crt tls.crt</span><br></pre></td></tr></table></figure>
<p>运行脚本：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sh create_self-signed-cert.sh  --ssl-domain=rancher.zkk.com   --ssl-trusted-ip=192.168.222.4 --ssl-size=2048 --ssl-date=3650</span><br></pre></td></tr></table></figure>
<p>生成的效果如下，会自动将证书文件重命名为<code>tls.crt</code>，将证书秘钥文件重命名为<code>tls.key</code> 。</p>
<p><img src="https://gitee.com/zuori/kaiscript/raw/master/images/20210202212143.png" alt=""></p>
<p><strong>3. 创建tls类型的secret</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">kubectl -n rancher create secret tls tls-rancher-ingress \</span><br><span class="line">  --cert&#x3D;tls.crt \</span><br><span class="line">  --key&#x3D;tls.key</span><br></pre></td></tr></table></figure>
<p><strong>4. 使用私有的CA签发证书</strong></p>
<p>拷贝 CA 证书到名为 <code>cacerts.pem</code> 的文件，在上一步的脚本中已经完成，使用 <code>kubectl</code> 命令在 <code>cattle-system</code> 命名空间中创建名为 <code>tls-ca</code> 的密文。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">kubectl -n rancher create secret generic tls-ca \</span><br><span class="line">  --from-file&#x3D;cacerts.pem&#x3D;.&#x2F;cacerts.pem</span><br></pre></td></tr></table></figure>
<h2 id="使用helm部署rancher">使用helm部署rancher</h2>
<p>Rancher 提供了几种不同的 Helm Chart 仓库供您选择。最新版或稳定版的 Rancher Helm Chart 与用于 Docker 安装的 Rancher 的 Docker 镜像标签对应。因此，<code>rancher-latest</code>仓库包含被标记为<code>rancher/rancher:latest</code>的版本。当 Rancher 版本升级到<code>rancher/rancher:stable</code>后，它将被添加到<code>rancher-stable</code>仓库中。</p>
<table>
<thead>
<tr>
<th>类别</th>
<th>添加仓库命令</th>
<th>仓库描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>rancher-latest</td>
<td><code>helm repo add rancher-latest https://releases.rancher.com/server-charts/latest</code></td>
<td>添加最新版本的 Rancher 的 Helm Chart 仓库。我们建议使用此仓库来测试新版本的 Rancher。</td>
</tr>
<tr>
<td>rancher-stable</td>
<td><code>helm repo add rancher-stable https://releases.rancher.com/server-charts/stable</code></td>
<td>添加较旧的，稳定的版本的 Rancher 的 Helm Chart 仓库。我们建议将此仓库用于生产环境。</td>
</tr>
<tr>
<td>rancher-alpha</td>
<td><code>helm repo add rancher-alpha https://releases.rancher.com/server-charts/alpha</code></td>
<td>添加 alpha 版本的 Rancher 的 Helm Chart 仓库，以预览即将发布的版本.不建议在生产环境中使用这些版本。我们不支持从 rancher alpha 仓库中的 chart 升级到任何其他版本 chart。</td>
</tr>
</tbody>
</table>
<p><strong>本地helm添加Rancher仓库</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">helm repo add rancher-stable https://releases.rancher.com/server-charts/stable</span><br></pre></td></tr></table></figure>
<p>使用helm安装有两种方式可供选择</p>
<ul>
<li>
<p><strong>直接使用helm安装</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">helm install rancher rancher-stable&#x2F;rancher \</span><br><span class="line">  --namespace rancher \</span><br><span class="line">  --set hostname&#x3D;rancher.zkk.com \</span><br><span class="line">  --set ingress.tls.source&#x3D;secret \</span><br><span class="line">  --set privateCA&#x3D;true</span><br></pre></td></tr></table></figure>
<p>执行命令</p>
<p><img src="https://gitee.com/zuori/kaiscript/raw/master/images/20210202222056.png" alt=""></p>
<p>等待pod启动完成，如果域名没做DNS解析，则需要在访问的机器上配置hosts，在浏览器访问：<a target="_blank" rel="noopener" href="https://rancher.zkk.com/">https://rancher.zkk.com/</a></p>
<p><img src="https://gitee.com/zuori/kaiscript/raw/master/images/20210203153355.png" alt=""></p>
<p>访问ok，rancher部署完成</p>
</li>
<li>
<p><strong>通过helm渲染模版进行安装</strong>，一般用于离线部署</p>
<p>用helm将Rancher模板下载到本地</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">helm fetch rancher-stable&#x2F;rancher	</span><br></pre></td></tr></table></figure>
<p>会在当前目录生成rancher的包，我这里是<code>rancher-2.5.5.tgz</code></p>
<p>用helm渲染Rancher模板</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"># 注意hostname用实际域名</span><br><span class="line">helm template rancher .&#x2F;rancher-2.5.5.tgz \</span><br><span class="line">     --namespace rancher --output-dir . \</span><br><span class="line">     --set privateCA&#x3D;true \</span><br><span class="line">     --set ingress.tls.source&#x3D;secret \</span><br><span class="line">     --set hostname&#x3D;rancher.zkk.com</span><br></pre></td></tr></table></figure>
<blockquote>
<p>参数说明：</p>
<p>rancher-2.5.5.tgz 是上一步骤下载的模板</p>
<p>–namespace 是Rancher的安装目标命名空间</p>
<p>–output-dir 是渲染的输出目录</p>
<p>–set privateCA 是否使用的是自签SSL证书</p>
<p>–set ingress.tls.source 使用K8S secret中的证书</p>
<p>–set hostname 配置访问Rancher的域名</p>
</blockquote>
<p>执行后会生成一个rancher目录，目录下有clusterRoleBinding.yaml、deployment.yaml、ingress.yaml、serviceAccount.yaml、service.yaml文件，使用这些yml文件即可安装Rancher，但是在安装之前我们得把我们之前自签名生成的SSL证书导入到K8S的secret里</p>
<p>执行一下命令安装Racnher集群</p>
<p>kubectl -n cattle-system apply -R -f ./rancher</p>
<p>观察安装进度</p>
<p>kubectl -n cattle-system get all</p>
<p>当观察到所有 pod/rancher-* 全部 ready 之后，即可访问 rancher 域名，如果域名没做DNS解析，则需要在访问的机器上配置hosts。</p>
</li>
</ul>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">张十三</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://zuori.gitee.io/zaker/2021/02/25/Rancher%E7%9A%84%E9%AB%98%E5%8F%AF%E7%94%A8%E5%AE%89%E8%A3%85/">http://zuori.gitee.io/zaker/2021/02/25/Rancher%E7%9A%84%E9%AB%98%E5%8F%AF%E7%94%A8%E5%AE%89%E8%A3%85/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://zuori.gitee.io/zaker" target="_blank">十三不知</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/zaker/tags/Kubernetes/">Kubernetes</a><a class="post-meta__tags" href="/zaker/tags/DevOps/">DevOps</a></div><div class="post_share"><div class="addthis_inline_share_toolbox"></div><script src="//s7.addthis.com/js/300/addthis_widget.js#pubid=null" async="async"></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/zaker/2021/03/03/Kubectl%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/"><img class="prev-cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="onerror=null;src='/zaker/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">kubectl 基本使用</div></div></a></div><div class="next-post pull-right"><a href="/zaker/2021/02/25/%E9%85%8D%E7%BD%AEStorageClass/"><img class="next-cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="onerror=null;src='/zaker/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">创建StorageClass</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/zaker/2021/03/25/K8s可视化监控之-Weave Scope/" title="Kubernetes集群可视化监控之-Weave Scope"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-25</div><div class="title">Kubernetes集群可视化监控之-Weave Scope</div></div></a></div><div><a href="/zaker/2019/04/25/YAML语法/" title="YAML语法简介"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-04-25</div><div class="title">YAML语法简介</div></div></a></div><div><a href="/zaker/2021/02/25/配置StorageClass/" title="创建StorageClass"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-02-25</div><div class="title">创建StorageClass</div></div></a></div><div><a href="/zaker/2021/03/03/Kubectl基本使用/" title="kubectl 基本使用"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-03</div><div class="title">kubectl 基本使用</div></div></a></div><div><a href="/zaker/2021/03/30/Kubernetes集群监控之 Metrics Server/" title="Kubernetes集群监控之 Metrics Server"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-30</div><div class="title">Kubernetes集群监控之 Metrics Server</div></div></a></div><div><a href="/zaker/2020/10/08/微服务的发布方式/" title="微服务的发布方式"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-10-08</div><div class="title">微服务的发布方式</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://gitee.com/zuori/kaiscript/raw/master/images/20210325192506.jpg" onerror="this.onerror=null;this.src='/zaker/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">张十三</div><div class="author-info__description"></div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/zaker/archives/"><div class="headline">文章</div><div class="length-num">13</div></a></div><div class="card-info-data-item is-center"><a href="/zaker/tags/"><div class="headline">标签</div><div class="length-num">11</div></a></div><div class="card-info-data-item is-center"><a href="/zaker/categories/"><div class="headline">分类</div><div class="length-num">4</div></a></div></div><a class="button--animated" id="card-info-btn" href="http://zuori.gitee.io/zaker"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">记录一点东西的地方</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">1.</span> <span class="toc-text">Rancher的高可用部署</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%94%9F%E6%88%90%E8%87%AA%E7%AD%BE%E5%90%8D%E8%AF%81%E4%B9%A6%E4%BB%A5%E5%8F%8A%E9%85%8D%E7%BD%AE%E5%AF%86%E9%92%A5"><span class="toc-number">1.1.</span> <span class="toc-text">生成自签名证书以及配置密钥</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8helm%E9%83%A8%E7%BD%B2rancher"><span class="toc-number">1.2.</span> <span class="toc-text">使用helm部署rancher</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/zaker/2021/03/30/Kubernetes%E9%9B%86%E7%BE%A4%E7%9B%91%E6%8E%A7%E4%B9%8B%20Metrics%20Server/" title="Kubernetes集群监控之 Metrics Server"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/zaker/img/404.jpg'" alt="Kubernetes集群监控之 Metrics Server"/></a><div class="content"><a class="title" href="/zaker/2021/03/30/Kubernetes%E9%9B%86%E7%BE%A4%E7%9B%91%E6%8E%A7%E4%B9%8B%20Metrics%20Server/" title="Kubernetes集群监控之 Metrics Server">Kubernetes集群监控之 Metrics Server</a><time datetime="2021-03-30T06:46:36.000Z" title="发表于 2021-03-30 14:46:36">2021-03-30</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/zaker/2021/03/26/RabbitMq%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8/" title="RabbitMq学习笔记"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/zaker/img/404.jpg'" alt="RabbitMq学习笔记"/></a><div class="content"><a class="title" href="/zaker/2021/03/26/RabbitMq%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8/" title="RabbitMq学习笔记">RabbitMq学习笔记</a><time datetime="2021-03-26T01:46:36.000Z" title="发表于 2021-03-26 09:46:36">2021-03-26</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/zaker/2021/03/25/K8s%E5%8F%AF%E8%A7%86%E5%8C%96%E7%9B%91%E6%8E%A7%E4%B9%8B-Weave%20Scope/" title="Kubernetes集群可视化监控之-Weave Scope"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/zaker/img/404.jpg'" alt="Kubernetes集群可视化监控之-Weave Scope"/></a><div class="content"><a class="title" href="/zaker/2021/03/25/K8s%E5%8F%AF%E8%A7%86%E5%8C%96%E7%9B%91%E6%8E%A7%E4%B9%8B-Weave%20Scope/" title="Kubernetes集群可视化监控之-Weave Scope">Kubernetes集群可视化监控之-Weave Scope</a><time datetime="2021-03-25T11:46:36.000Z" title="发表于 2021-03-25 19:46:36">2021-03-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/zaker/2021/03/25/Linux%E5%B0%86%E6%99%AE%E9%80%9A%E7%94%A8%E6%88%B7%E5%8A%A0%E5%85%A5sudo%E7%BB%84/" title="Linux将一般用户加入sudo组"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/zaker/img/404.jpg'" alt="Linux将一般用户加入sudo组"/></a><div class="content"><a class="title" href="/zaker/2021/03/25/Linux%E5%B0%86%E6%99%AE%E9%80%9A%E7%94%A8%E6%88%B7%E5%8A%A0%E5%85%A5sudo%E7%BB%84/" title="Linux将一般用户加入sudo组">Linux将一般用户加入sudo组</a><time datetime="2021-03-25T11:46:36.000Z" title="发表于 2021-03-25 19:46:36">2021-03-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/zaker/2021/03/03/Kubectl%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/" title="kubectl 基本使用"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/zaker/img/404.jpg'" alt="kubectl 基本使用"/></a><div class="content"><a class="title" href="/zaker/2021/03/03/Kubectl%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/" title="kubectl 基本使用">kubectl 基本使用</a><time datetime="2021-03-03T11:46:36.000Z" title="发表于 2021-03-03 19:46:36">2021-03-03</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 张十三</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/zaker/js/utils.js"></script><script src="/zaker/js/main.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"></div><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="false" data-click="false"></script><script defer="defer" id="fluttering_ribbon" mobile="true" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>